package com.bosssoft.hr.javase;

/**
 * @Description: HashMapExample测试类
 * @Author: WengYu
 * @CreateTime: 2022/05/16 22:12
 */
public class HashMapExampleTest {
    public static void main(String[] args) {
        HashMapExample hashMapExample = new HashMapExample();
        User user1 = new User(1, "wengyu1");
        User user2 = new User(2, "wengyu2");
        User user3 = new User(3, "wengyu3");

        System.out.println("第一种遍历--------------------》");
        hashMapExample.put(user1.getId(),user1);
        System.out.println("第二种遍历--------------------》");
        hashMapExample.put(user2.getId(),user2);
        System.out.println("第三种遍历--------------------》");
        hashMapExample.put(user3.getId(),user3);

        hashMapExample.visitByEntrySet();
        hashMapExample.visitByKeySet();
        hashMapExample.visitByValues();

        System.out.println("是否存在："+hashMapExample.containsKey(1));
        System.out.println("删除是否成功："+hashMapExample.remove(2));
        System.out.println("删除后遍历--------------------》");
        hashMapExample.visitByEntrySet();
    }
}
